YAddress address(std::string("127.0.0.1"), 8000);
	SelectPoll pool;
	YTCPClient client;
	bool isConnect = client.connect(&address);
	if (!isConnect)
	{
		auto errorID = client.getLastError();
		std::cout << strerror(errorID) << std::endl;
	}

	const char *request = "GET / HTTP/1.1\r\n\r\n";
	client.send(request, strlen(request));

	client.onError([](YSocket* socket) {
		auto errorID = socket->getLastError();
		std::cout << strerror(errorID) << std::endl;
	});

	client.onRead([](YSocket* socket) {
		YTCPClient* client = (YTCPClient*)socket;
		char buff[2024] = { 0x00 };
		auto c = client->receive(buff, 2024);
		if (c == 0)
		{
			
			client->close();
		}
		std::cout << "recv size:" << c << std::endl;
		std::cout << "recv data:" << std::string(buff,c) << std::endl;
	});
	client.setIOPoll(&pool);

	std::cout << client.remote_address()->getHost();
	while (true)
	{
		pool.wait(1);
	}